package com.mytaobao.main.firsttab.func.flashsale;

import android.content.Context;
import android.util.AttributeSet;

import com.mytaobao.R;
import com.mytaobao.main.firsttab.view.ItemViewGroupBase;
import com.tmall.wireless.tangram.structure.BaseCell;
import com.tmall.wireless.tangram.structure.view.ITangramViewLifeCycle;

import java.util.ArrayList;

/**
 * 淘海购
 */
public class ItemFlashSaleView extends ItemViewGroupBase implements ITangramViewLifeCycle{

    private ItemFlashSaleData itemFlashSaleData = new ItemFlashSaleData();

    public ItemFlashSaleView(Context context) {
        super(context);
        init(context, R.layout.item_flash_sale);
    }

    public ItemFlashSaleView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, R.layout.item_flash_sale);
    }

    public ItemFlashSaleView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, R.layout.item_flash_sale);
    }

    @Override
    public void cellInited(BaseCell cell) {

    }

    @Override
    public void postBindView(BaseCell cell) {
        itemFlashSaleData.setContents(
                new ArrayList<ArrayList<SubItemFlashSaleData>>() {{
                    add(new ArrayList<SubItemFlashSaleData>() {{
                        add(new SubItemFlashSaleData(R.drawable.time, "抢淘购", "ReverseClock", R.drawable.taoqianggou1, R.drawable.taoqianggou2));
                        add(new SubItemFlashSaleData(R.drawable.appreciate, "有好货", "高颜值美物", R.drawable.youhaohuo1, R.drawable.youhaohuo2));
                    }});
                    add(new ArrayList<SubItemFlashSaleData>() {{
                        add(new SubItemFlashSaleData(R.drawable.time, "爱逛街", "时髦流行款", R.drawable.aiguangjie1, R.drawable.aiguangjie2));
                        add(new SubItemFlashSaleData(R.drawable.appreciate, "必买清单", "一站式攻略", R.drawable.bimaiqingdan1, R.drawable.bimaiqingdan2));
                    }});
                }}
        );
        itemFlashSaleData.setWeights(
                new ArrayList<ArrayList<Float>>() {{
                    add(new ArrayList<Float>() {{
                        add((float) 0.5);
                        add((float) 0.5);
                    }});
                    add(new ArrayList<Float>() {{
                        add((float) 0.5);
                        add((float) 0.5);
                    }});
                }}
        );
    }

    @Override
    public void postUnBindView(BaseCell cell) {

    }
}
